package com.example.link.controller;

import com.example.common.common.config.filter.UserContext;
import com.example.link.model.CreateLinkGroupDTO;
import lombok.RequiredArgsConstructor;
import com.example.link.model.LinkGroupVO;
import org.springframework.web.bind.annotation.*;
import com.example.link.service.LinkGroupService;

import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/8/17 19:57
 **/
@RestController
@RequestMapping("/api/link/group")
@RequiredArgsConstructor
public class LinkGroupController {
    private final LinkGroupService linkGroupService;
    @PostMapping("/create")
    public void createShortLink(@RequestBody CreateLinkGroupDTO createLinkGroupDTO) {
        // 权限校验

        // 创建短链接
        linkGroupService.createLinkGroup(createLinkGroupDTO);
    }


    @GetMapping("/get")
    public List<LinkGroupVO> getLinkGroup() {
        return linkGroupService.getLinkGroup(UserContext.getCurrentUser().getUserId());
    }
}
